package com.example.arffrecorder.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;

import com.example.arffrecorder.ImageAdapter;
import com.example.arffrecorder.R;

public class MainScreen extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		GridView gridview = (GridView) findViewById(R.id.gridview);
		gridview.setAdapter(new ImageAdapter(this));

		gridview.setOnItemClickListener(getOnClickListener());
	}

	protected AdapterView.OnItemClickListener getOnClickListener() {
		AdapterView.OnItemClickListener onClickListener = new AdapterView.OnItemClickListener() {

			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				// Toast.makeText(MainScreen.this, "" + position,
				// Toast.LENGTH_SHORT).show();
				// start the recording activity
				if (position == 0) {
					startActivitity();
				}
			}

		};
		return onClickListener;

	}

	protected void startActivitity() {
		Intent i = new Intent(MainScreen.this, RecordingActivity.class);
		startActivity(i);
	}
}
